[20250203] BOJ / 골드5 / 모노톤길 / 이강현 #20
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/11067
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
서쪽에서 동쪽으로만 한 방향으로 이동할 수 있고 위 아래로 이동은 가능한 격자무늬의 맵이 있고 존재하는 카페의 위치 좌표가 주어질 때 카페 좌표만으로 이동할 수 있는 길을 만들기 위해 카페에 번호를 붙인다. 특정 번호가 주어질 때 카페의 위치 좌표를 출력.
🔍 풀이 방법
왼쪽에서 오른쪽으로 밖에 움직일 수 없기에 x좌표가 커지는 순서대로 카페를 정렬하기 위해 treemap의 키로 카페들의 x좌표를 이용, 같은 x좌표를 가진 카페들 중 이전 카페와 y좌표가 같은 카페부터 순차적으로 오름차순 혹은 내림차순으로 번호가 붙여지므로 priority queue를 사용하여 꺼내면서 번호를 붙였다.
⏳ 회고
단순 구현 문젠데 다양한 자료구조를 활용하다보니 좀 헷갈렸음.